package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.StandardBaseAttendExtraHours;
import com.group.project.hrms.mapper.StandardBaseAttendExtraHoursMapper;
import com.group.project.hrms.service.IStandardBaseAttendExtraHoursService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class StandardBaseAttendExtraHoursService implements IStandardBaseAttendExtraHoursService {

    @Autowired
    private StandardBaseAttendExtraHoursMapper standardBaseAttendExtraHoursMapper;


    @Override
    public int insertStandardBaseAttendExtraHours(StandardBaseAttendExtraHours baseAttendExtraHours) {
        return standardBaseAttendExtraHoursMapper.insert(baseAttendExtraHours);
    }

    @Override
    public int deleteStandardBaseAttendExtraHours(StandardBaseAttendExtraHours baseAttendExtraHours) {
        return standardBaseAttendExtraHoursMapper.deleteByPrimaryKey(baseAttendExtraHours);
    }

    @Override
    public int updateStandardBaseAttendExtraHours(StandardBaseAttendExtraHours baseAttendExtraHours) {
        return standardBaseAttendExtraHoursMapper.updateByPrimaryKey(baseAttendExtraHours);
    }

    @Override
    public StandardBaseAttendExtraHours selectOneStandardBaseAttendExtraHours(StandardBaseAttendExtraHours baseAttendExtraHours) {
        return null;
    }

    @Override
    public StandardBaseAttendExtraHours selectOneStandardBaseAttendExtraHoursByGroupID(String gid) {
        Example example = new Example(StandardBaseAttendExtraHours.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("attendGroupId" , gid);
        return standardBaseAttendExtraHoursMapper.selectOneByExample(example);
    }

    @Override
    public List<StandardBaseAttendExtraHours> selectAllStandardBaseAttendExtraHours() {
        return standardBaseAttendExtraHoursMapper.selectAll();
    }
}
